﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.Localization;

namespace Terraria.ModLoader
{
	// Token: 0x020001F8 RID: 504
	public class ModWall
	{
		// Token: 0x170001A1 RID: 417
		// (get) Token: 0x060015F9 RID: 5625 RVA: 0x00010BB1 File Offset: 0x0000EDB1
		// (set) Token: 0x060015FA RID: 5626 RVA: 0x00010BB9 File Offset: 0x0000EDB9
		public Mod mod { get; internal set; }

		// Token: 0x170001A2 RID: 418
		// (get) Token: 0x060015FB RID: 5627 RVA: 0x00010BC2 File Offset: 0x0000EDC2
		// (set) Token: 0x060015FC RID: 5628 RVA: 0x00010BCA File Offset: 0x0000EDCA
		public string Name { get; internal set; }

		// Token: 0x170001A3 RID: 419
		// (get) Token: 0x060015FD RID: 5629 RVA: 0x00010BD3 File Offset: 0x0000EDD3
		// (set) Token: 0x060015FE RID: 5630 RVA: 0x00010BDB File Offset: 0x0000EDDB
		public ushort Type { get; internal set; }

		// Token: 0x060015FF RID: 5631 RVA: 0x00414914 File Offset: 0x00412B14
		public void AddMapEntry(Color color, LocalizedText name = null)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name);
				if (!MapLoader.wallEntries.Keys.Contains(this.Type))
				{
					MapLoader.wallEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.wallEntries[this.Type].Add(item);
			}
		}

		// Token: 0x06001600 RID: 5632 RVA: 0x00010BE4 File Offset: 0x0000EDE4
		public ModTranslation CreateMapEntryName(string key = null)
		{
			if (string.IsNullOrEmpty(key))
			{
				key = this.Name;
			}
			return this.mod.GetOrCreateTranslation(string.Format("Mods.{0}.MapObject.{1}", this.mod.Name, key), false);
		}

		// Token: 0x06001601 RID: 5633 RVA: 0x00414974 File Offset: 0x00412B74
		public void AddMapEntry(Color color, ModTranslation name)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name);
				if (!MapLoader.tileEntries.Keys.Contains(this.Type))
				{
					MapLoader.tileEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.tileEntries[this.Type].Add(item);
			}
		}

		// Token: 0x06001602 RID: 5634 RVA: 0x004149D4 File Offset: 0x00412BD4
		public void AddMapEntry(Color color, LocalizedText name, Func<string, int, int, string> nameFunc)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name, nameFunc);
				if (!MapLoader.wallEntries.Keys.Contains(this.Type))
				{
					MapLoader.wallEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.wallEntries[this.Type].Add(item);
			}
		}

		// Token: 0x06001603 RID: 5635 RVA: 0x00414A34 File Offset: 0x00412C34
		public void AddMapEntry(Color color, ModTranslation name, Func<string, int, int, string> nameFunc)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name, nameFunc);
				if (!MapLoader.wallEntries.Keys.Contains(this.Type))
				{
					MapLoader.wallEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.wallEntries[this.Type].Add(item);
			}
		}

		// Token: 0x06001604 RID: 5636 RVA: 0x00010C18 File Offset: 0x0000EE18
		public virtual bool Autoload(ref string name, ref string texture)
		{
			return this.mod.Properties.Autoload;
		}

		// Token: 0x06001605 RID: 5637 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SetDefaults()
		{
		}

		// Token: 0x06001606 RID: 5638 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool KillSound(int i, int j)
		{
			return true;
		}

		// Token: 0x06001607 RID: 5639 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void NumDust(int i, int j, bool fail, ref int num)
		{
		}

		// Token: 0x06001608 RID: 5640 RVA: 0x00010C2A File Offset: 0x0000EE2A
		public virtual bool CreateDust(int i, int j, ref int type)
		{
			type = this.dustType;
			return true;
		}

		// Token: 0x06001609 RID: 5641 RVA: 0x00010C35 File Offset: 0x0000EE35
		public virtual bool Drop(int i, int j, ref int type)
		{
			type = this.drop;
			return true;
		}

		// Token: 0x0600160A RID: 5642 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void KillWall(int i, int j, ref bool fail)
		{
		}

		// Token: 0x0600160B RID: 5643 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool CanExplode(int i, int j)
		{
			return true;
		}

		// Token: 0x0600160C RID: 5644 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual ushort GetMapOption(int i, int j)
		{
			return 0;
		}

		// Token: 0x0600160D RID: 5645 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
		{
		}

		// Token: 0x0600160E RID: 5646 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void RandomUpdate(int i, int j)
		{
		}

		// Token: 0x0600160F RID: 5647 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void AnimateWall(ref byte frame, ref byte frameCounter)
		{
		}

		// Token: 0x06001610 RID: 5648 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool PreDraw(int i, int j, SpriteBatch spriteBatch)
		{
			return true;
		}

		// Token: 0x06001611 RID: 5649 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void PostDraw(int i, int j, SpriteBatch spriteBatch)
		{
		}

		// Token: 0x06001612 RID: 5650 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void PlaceInWorld(int i, int j, Item item)
		{
		}

		// Token: 0x04001524 RID: 5412
		internal string texture;

		// Token: 0x04001525 RID: 5413
		public int soundType;

		// Token: 0x04001526 RID: 5414
		public int soundStyle = 1;

		// Token: 0x04001527 RID: 5415
		public int dustType;

		// Token: 0x04001528 RID: 5416
		public int drop;
	}
}
